#!/usr/bin/env bash

set -e

appdir=$(cd "$(dirname "$0")/.." && pwd)

# Create the databases
docker-compose run --rm app mysql -h db -uroot -e "create database if not exists janky_development"
docker-compose run --rm app mysql -h db -uroot -e "create database if not exists janky_test"

# Create the tables
docker-compose run --rm app bin/rake db:migrate
docker-compose run --rm -e RACK_ENV=test app bin/rake db:migrate

docker-compose run --rm app bin/rake db:seed
